<?php
/**
 * @version        $Id: tags.php 1 2010-06-30 11:43:09Z tianya $
 * @package        DedeCMS.Site
 * @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license        http://help.dedecms.com/usersguide/license.html
 * @link           http://www.dedecms.com
 */

//引入公共配置文件
require_once (dirname(__FILE__) . "/include/common.inc.php");

//引入taglist类
require_once (DEDEINC . "/arc.taglist.class.php");

//默认是第一页
$PageNo = 1;

//如果有参数 $_SERVER['QUERY_STRING'] ，例如 tag.php?id=5，他获取?后的值
if(isset($_SERVER['QUERY_STRING']))
{
    $tag = trim($_SERVER['QUERY_STRING']);
    //默认格式是这样的 tags.php?/%B1%EA%C7%A92/，输出 Array ( [0] => [1] => %B1%EA%C7%A92 [2] => )
    $tags = explode('/', $tag);
    
    //取值 %B1%EA%C7%A92 [2]
    if(isset($tags[1])) $tag = $tags[1];
    
    //如果有页码，取值
    if(isset($tags[2])) $PageNo = intval($tags[2]);
}
else
{
    $tag = '';
}

//urldecode - url转义
//FilterSearch - 过滤用于搜索的字符串，这个函数在 include/common.func.php 文件中
$tag = FilterSearch(urldecode($tag));

//安全设置
if($tag != addslashes($tag)) $tag = '';

//TagList类 在 include/arc.taglist.class.php
if($tag == '') $dlist = new TagList($tag, 'tag.htm');
else $dlist = new TagList($tag, 'taglist.htm');

//显示
$dlist->Display();

//退出
exit();